/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.applicatioN.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Slim
 */
@Entity
@Table(name = "maitriser_l")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MaitriserL.findAll", query = "SELECT m FROM MaitriserL m"),
    @NamedQuery(name = "MaitriserL.findByNiveau", query = "SELECT m FROM MaitriserL m WHERE m.niveau = :niveau"),
    @NamedQuery(name = "MaitriserL.findByIdentifiant", query = "SELECT m FROM MaitriserL m WHERE m.maitriserLPK.identifiant = :identifiant"),
    @NamedQuery(name = "MaitriserL.findByIntitule", query = "SELECT m FROM MaitriserL m WHERE m.maitriserLPK.intitule = :intitule")})
public class MaitriserL implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected MaitriserLPK maitriserLPK;
    @Basic(optional = false)
    @Column(name = "NIVEAU")
    private int niveau;
    @JoinColumn(name = "INTITULE", referencedColumnName = "INTITULE", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Langue langue;
    @JoinColumn(name = "IDENTIFIANT", referencedColumnName = "IDENTIFIANT", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Candidat candidat;

    public MaitriserL() {
    }

    public MaitriserL(MaitriserLPK maitriserLPK) {
        this.maitriserLPK = maitriserLPK;
    }

    public MaitriserL(MaitriserLPK maitriserLPK, int niveau) {
        this.maitriserLPK = maitriserLPK;
        this.niveau = niveau;
    }

    public MaitriserL(int identifiant, String intitule) {
        this.maitriserLPK = new MaitriserLPK(identifiant, intitule);
    }

    public MaitriserLPK getMaitriserLPK() {
        return maitriserLPK;
    }

    public void setMaitriserLPK(MaitriserLPK maitriserLPK) {
        this.maitriserLPK = maitriserLPK;
    }

    public int getNiveau() {
        return niveau;
    }

    public void setNiveau(int niveau) {
        this.niveau = niveau;
    }

    public Langue getLangue() {
        return langue;
    }

    public void setLangue(Langue langue) {
        this.langue = langue;
    }

    public Candidat getCandidat() {
        return candidat;
    }

    public void setCandidat(Candidat candidat) {
        this.candidat = candidat;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (maitriserLPK != null ? maitriserLPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MaitriserL)) {
            return false;
        }
        MaitriserL other = (MaitriserL) object;
        if ((this.maitriserLPK == null && other.maitriserLPK != null) || (this.maitriserLPK != null && !this.maitriserLPK.equals(other.maitriserLPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.applicatioN.entities.MaitriserL[ maitriserLPK=" + maitriserLPK + " ]";
    }
    
}
